home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Yerk 3.64 / Toolbox Classes / date < prev    next >
Text File  |  1993-04-10  |  1KB  |  53 lines

  1. \ Date - Date/time support
  2. \ 01/15/85    cbd  Version 1
  3. \ 03/11/87    rfl    ability to put any date in and print it
  4. \                also changed basicstr to bytes
  5. \ 01/19/90    rfl    added getTime:
  6. \ 04/10/93    rfl added getDate:
  7.  
  8. Decimal
  9.  
  10. \ ( secs dtRec -- )
  11.  Create secs2date   popA0  popD0 $ a9c6 w, next, 
  12.  
  13.  : dig2   0 <# # # #>  type  ; 
  14.  
  15.  :CLASS  DateTime  <Super Object
  16.  
  17.     Int         Year
  18.     Int         Month
  19.     Int         Day
  20.     Int         Hour
  21.     Int         Minute
  22.     Int         Second
  23.     Int         dayOfWeek
  24.     22 bytes    dayNames
  25.  
  26.     \ get the system date and time 
  27.     :M  GET:   $ 20c -base  @ (abs)  secs2date   ;M
  28.  
  29.     :M  PUT: (abs) secs2date ;M
  30.  
  31.     :M  PRINTDAY:   get: dayOfWeek 1- 3 * addr: dayNames  + 
  32.          3  type  ;M 
  33.  
  34.     :M  PRINTDATE:    get: month dig2  ascii / emit 
  35.         get: day dig2 ascii / emit
  36.         get: year 1900 - dig2   ;M
  37.  
  38.     :M  PRINTTIME:   get: hour  dig2 ascii : emit 
  39.          get: minute dig2  ascii : emit get: second dig2  ;M
  40.  
  41.     :M  classINIT: " SunMonTueWedThuFriSat" addr: dayNames swap cmove  ;M
  42.   
  43.     :M  PRINT:  printday: self space   printdate: self   
  44.            2 spaces printtime: self  ;M
  45.  
  46.     :M  getTime: get: hour get: minute get: second ;M
  47.  
  48.     :M  getDate: get: year get: month get: day ;M
  49.  
  50. ;CLASS
  51.  
  52. dateTime  sysDate
  53.